<template>
  <div>
    <el-descriptions class="margin-top"
                     :column="1"
                     border>
      <template slot="extra">
        <download-excel class="export-excel-wrapper"
                        :data="json_data_log"
                        :fields="json_fields_log"
                        name="回执单.xls">
          <el-button type="primary"
                     icon="el-icon-download"
                     size="small">下载回执单</el-button>
        </download-excel>
      </template>
      <el-descriptions-item label="合同编号">{{receiptForm.contractId}}</el-descriptions-item>
      <el-descriptions-item label="回执描述">{{receiptForm.acceptanceRecords}}</el-descriptions-item>
      <el-descriptions-item label="回执时间">{{receiptForm.createTime}}</el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script>
import { listADriverReceipt } from '@/api/receive/drivercheck'
export default {
  name: 'Index',
  data() {
    return {
      form: {},
      receiptForm: {},
      json_fields_log: {
        "合同编号": 'contractId',
        "回执描述": 'acceptanceRecords',
        "回执时间": 'createTime',
      },
      json_data_log: [],
    }
  },
  created() {
    this.$bus.on('thebus', (val) => {
      this.form.contractId = val
      //请求回执单
      listADriverReceipt(this.form).then((response) => {
        this.receiptForm = response
        this.json_data_log.push(response)
        // let arr = []
        // arr.push(response)
        // this.json_data_log = arr
        // debugger
        console.log(response)
      })
    })
  },
  beforeDestroy() {
    this.$bus.$off('thebus')
  },
  methods: {},
}
</script>

<style>
</style>

